/*
 * Middleware
 * Copyright (C) 2010/11
 * Riccardo Pulvirenti, Giuseppe Ravidà, Andrea Tino
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses
 */

/*!
 * File: data.hpp
 */

#ifndef _DATA_HPP_
#define _DATA_HPP_

#include <iostream>
#include <string>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>

//-----------------------------------------------------------------------------
// Class definitions
namespace middleware {
/*!
 * Class representing data to be sent to wroker in order to execute task.
 */
class Data {
public:
	/*!
	 * Default constructor.
	 */
	Data() {
		this->_data_str = std::string("data");
		this->_data_int = 0;
	}
	/*!
	 * Parametric constructor.
	 */
	Data(const std::string& str, int i) {
		this->_data_str = str;
		this->_data_int = i;
	}
	/*!
	 * Copy constructor.
	 */
	Data(const Data& data) {
		this->_data_str = data._data_str;
		this->_data_int = data._data_int;
	}
	/*!
	 * Destructor.
	 */
	~Data() {

	}
	/*!
	 * Getting data string.
	 */
	std::string get_data_str() {
		return this->_data_str;
	}
	/*!
	 * Getting data int.
	 */
	int get_data_int() {
		return this->_data_int;
	}
	/*!
	 * Setting data string.
	 */
	void set_data_str(std::string str_data) {
		this->_data_str = str_data;
	}
	/*!
	 * Setting data int.
	 */
	void set_data_int(int int_data) {
		this->_data_int = int_data;
	}
private:
	friend class boost::serialization::access;
	/*!
	 * BOOST serialization function.
	 */
	template<class Archive>
	void serialize(Archive & ar, const unsigned int version) {
		ar & _data_str;
		ar & _data_int;
	}
	/*!
	 * Data representation string.
	 */
	std::string _data_str;
	/*!
	 * Data representation int.
	 */
	int _data_int;
}; /* Data */
} /* middleware */

#endif
